// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import router from './router'
import 'ant-design-vue/dist/antd.less';
import App from './App'
import store  from  './store'
import filters from './filter.js' //filters 引入
import base from './assets/js/base.js' //全局函数引入

ES6Promise.polyfill()

// 读取本地json语言包
const LANGUAGES = {
   zh_cn: require('./assets/languages/zh_cn.json'),
   en: require('./assets/languages/en.json')
}

Vue.config.productionTip = false

Vue.use(antd)//antd由本地引入 
Vue.use(base)

//全局注册store
Vue.prototype.$store=store;

//过滤器
for(let key in filters){
  Vue.filter(key,filters[key]);
}

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App :LANGUAGES=LANGUAGES />',
  provide(){
    return{
       reload:this.reload
    }
  },
  data:{
  	  LANGUAGES : LANGUAGES[store.state.language],

  },
  methods:{
      reload(){ 
          // console.log('main.js_Reload',store.state.language)
          this.LANGUAGES = store.state.language == 'en' ? LANGUAGES['en'] : LANGUAGES['zh_cn']
      }
  } 

})